package com.gzhu.knowledgeAdmin.controller;


import com.gzhu.knowledgeAdmin.common.dto.intention.IntentionAddRequest;
import com.gzhu.knowledgeAdmin.common.dto.intention.IntentionDeleteRequest;
import com.gzhu.knowledgeAdmin.common.dto.intention.IntentionGetRequest;
import com.gzhu.knowledgeAdmin.common.dto.intention.IntentionUpdateRequest;
import com.gzhu.knowledgeAdmin.common.result.R;
import com.gzhu.knowledgeAdmin.common.vo.IntentionVo;
import com.gzhu.knowledgeAdmin.service.impl.IntentionServiceImpl;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping
public class IntentionController {

    @Resource
    private IntentionServiceImpl intentionServiceImpl;

    @PostMapping("/intention")
    public R getIntention(@RequestBody IntentionGetRequest intentionGetRequest){

        List<IntentionVo> list = intentionServiceImpl.getIntention(intentionGetRequest);

        return R.ok(list);
    }

    @PostMapping("/intention/add")
    public R addIntention(@RequestBody IntentionAddRequest intentionAddRequest){

        intentionServiceImpl.addIntention(intentionAddRequest);

        return R.ok();
    }

    @PostMapping("/intention/update")
    public R updateIntention(@RequestBody IntentionUpdateRequest intentionUpdateRequest){

        intentionServiceImpl.updateIntention(intentionUpdateRequest);

        return R.ok();
    }

    @PostMapping("/intention/delete")
    public R deleteIntention(@RequestBody IntentionDeleteRequest intentionDeleteRequest){

        intentionServiceImpl.deleteIntention(intentionDeleteRequest);

        return R.ok();
    }
}
